package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.Relation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface RelationMapper extends MyMapper<Relation> {

    /**
     *根据uuid获取relation
     */
    @Select(value = "select * from t_relation t where t.uuid = #{uuid}")
    public Relation getRelationByUuid(String uuid);

    /**
     * 根据data_id和employee_id来获取relation
     */
    public Relation getRelationByEmployeeAndDid(@Param("employeeId")Integer employeeId,@Param("dataId") String dataId);


    /**
     * 根据data_id和num_type来获取relation
     */
    @Select(value = "select * from t_relation t where t.enum_type=#{enumType} and data_id=#{dataId} and content like CONCAT('%',#{content},'%') ")
    public Relation getRelationByCondition(@Param("enumType")String enumType,@Param("dataId") String dataId,@Param("content") String content);
}
